﻿using MaxLeaf.Platform.BLLProxy;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using MaxLeaf.Platform.DataContract;
using System.Collections.Generic;

namespace BLLUnitTest
{
    
    
    /// <summary>
    ///这是 CompanyProcessorProxyTest 的测试类，旨在
    ///包含所有 CompanyProcessorProxyTest 单元测试
    ///</summary>
    [TestClass()]
    public class CompanyProcessorProxyTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///获取或设置测试上下文，上下文提供
        ///有关当前测试运行及其功能的信息。
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region 附加测试特性
        // 
        //编写测试时，还可使用以下特性:
        //
        //使用 ClassInitialize 在运行类中的第一个测试前先运行代码
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //使用 ClassCleanup 在运行完类中的所有测试后再运行代码
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //使用 TestInitialize 在运行每个测试前先运行代码
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //使用 TestCleanup 在运行完每个测试后运行代码
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///InitData 的测试
        ///</summary>
        [TestMethod()]
        public void InitDataTest()
        {
            CompanyProcessorProxy target = new CompanyProcessorProxy(); // TODO: 初始化为适当的值
            int intFromCompanyID = -1; // TODO: 初始化为适当的值
            int intToCompanyID = 10; // TODO: 初始化为适当的值
            bool expected = false; // TODO: 初始化为适当的值
            bool actual;
            actual = target.InitData(intFromCompanyID, intToCompanyID);
            Assert.AreEqual(expected, actual);
            
        }

        /// <summary>
        ///GetUserSN 的测试
        ///</summary>
        [TestMethod()]
        public void GetUserSNTest()
        {
            CompanyProcessorProxy target = new CompanyProcessorProxy(); // TODO: 初始化为适当的值
            bool blnDirectCity = false; // TODO: 初始化为适当的值
            int intProvID = 26; // TODO: 初始化为适当的值
            int intCityID = 322; // TODO: 初始化为适当的值
            int intRegionID = 0; // TODO: 初始化为适当的值
            string expected = string.Empty; // TODO: 初始化为适当的值
            string actual;
            actual = target.GetUserSN(blnDirectCity, intProvID, intCityID, intRegionID);
            Assert.AreEqual(expected, actual);
            
        }

        /// <summary>
        ///AddCompany 的测试
        ///</summary>
        [TestMethod()]
        public void AddCompanyTest()
        {
            CompanyProcessorProxy target = new CompanyProcessorProxy(); // TODO: 初始化为适当的值
            mCompanyDataModel company = new mCompanyDataModel() { Company_Name = "0515测试0524", ParentID = 75, eMail = "K0524@qq.com", Mobile = "0524-99944432", PassWord = "666666" }; // TODO: 初始化为适当的值
            mCompany_InfoDataModel company_info = new mCompany_InfoDataModel(); // TODO: 初始化为适当的值
            List<SCPCategoryDataModel> lstSCP =new List<SCPCategoryDataModel>(); // TODO: 初始化为适当的值
            foreach (SCPCategoryDataModel scp in new MtnBLLProxy().SelectByCond(new SCPCategoryDataModel(), new List<AddInfo>() { 
                new AddInfo(){
                      Name= AddInfoType.Cond 
                      ,Value=new List<Cond>(){
                          new Cond(){ PropName="Companyid", Compare= CompareType.Equal ,  Value=-1}
                      }
                }
            }).Data)
            {
                lstSCP.Add(scp);
            }
            mUser_MainDataModel user = new mUser_MainDataModel() { Name = "0515测试0524", is_LocAppro = true , PassWord = "666666" }; // TODO: 初始化为适当的值
            mUser_InfoDataModel user_info = new mUser_InfoDataModel() {  Is_OrderUser=true}; // TODO: 初始化为适当的值
            int expected = -1; // TODO: 初始化为适当的值
            int actual;
            actual = target.AddCompany(company, company_info, lstSCP, user, user_info);
            Assert.AreEqual(expected, actual);
            
        }

        /// <summary>
        ///AddUser 的测试
        ///</summary>
        [TestMethod()]
        public void AddUserTest()
        {
            CompanyProcessorProxy target = new CompanyProcessorProxy(); // TODO: 初始化为适当的值
            mUser_MainDataModel User = new mUser_MainDataModel() { Name = "0515测试05242" , CompanyID=125, is_LocAppro = false, PassWord = "666666" }; // TODO: 初始化为适当的值
            mUser_InfoDataModel User_info = new mUser_InfoDataModel() { CompanyID=125, Is_OrderUser = false ,Is_DepAppro=true }; // TODO: 初始化为适当的值
            int expected = -1; // TODO: 初始化为适当的值
            int actual;
            actual = target.AddUser(User, User_info);
            Assert.AreEqual(expected, actual);
            
        }
    }
}
